package lion.formail.reader.reader;

import lion.formail.reader.reader.v4.IndReaderFactory;
import lion.formail.reader.reader.v5.IndxReaderFactory;

public abstract class ReaderFactory {

	public static ReaderFactory getReaderFactoryByName(String fileName) throws IllegalArgumentException {

		if (fileName.toLowerCase().endsWith("ind")) {
			return new IndReaderFactory();
		} else if (fileName.toLowerCase().endsWith("indx")) { return new IndxReaderFactory(); }
		throw new IllegalArgumentException("the filename is not endwith foxmail's index file'suffix :indx or ind");
	}

	public abstract IReader getReader();

}
